db = require '../utils/db'
module.exports = 
	'get /main/blog': (req, res)->
		sql = "select * from blog where active = 1"
		db.runSql sql, (err, result)->
			result.forEach (item)->
				delete item.content
			res.send result

	'get /main/blog/:id': (req, res)->
		sql = "select * from blog where id = ?"
		db.queryOne sql, [req.params.id], (err, result)->
			res.send result